<?php

require_once dirname(__FILE__).'/../lib/type_artistiqueGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/type_artistiqueGeneratorHelper.class.php';

/**
 * type_artistique actions.
 *
 * @package    tfe
 * @subpackage type_artistique
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class type_artistiqueActions extends autoType_artistiqueActions
{
    // utile pour que les actions batch respectent le softDelete
    protected function executeBatchDelete(sfWebRequest $request) {
        $ids = $request->getParameter('ids');

        $records = Doctrine_Query::create()
                ->select()
                ->from('TypeArtistique')
                ->whereIn('id', $ids)
                ->execute();

        $count = 0;
        foreach($records as $record){
            $count += $record->delete();
        }

        if ($count >= count($ids)) {
            $this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.');
        }
        else {
            $this->getUser()->setFlash('error', 'A problem occurs when deleting the selected items.');
        }

        $this->redirect('@type_artistique');
    }
}
